<uieip type="page" value="login" debug="true" timeout="5000"></uieip>
<uieip type="reg" value="console"></uieip>
<!DOCTYPE html>
<html>

<head>
    <uieip type="file" value="inc" src="/yqwin/easyui/include.txt" cache="true" minute="1440"></uieip>
    <uieip type="file" value="css" src="/yqwin/css/yqwin.min" cache="false"></uieip>
    <uieip type="file" value="js" src="/yqwin/src/yqwin.min" cache="false"></uieip>
    <title>MdiWin Demo - edit</title>
</head>

<body>
    <h1>yqWinPopEdit</h1>
    <div id="main_edit"></div>
    <a id="btn_EditWindow" href="javascript:params();" class="easyui-linkbutton" data-options="">params</a>
    <a id="btn_EditWindow" href="javascript:save();" class="easyui-linkbutton" data-options="">save</a>
    <a id="btn_EditWindow" href="javascript:close();" class="easyui-linkbutton" data-options="">close</a>
    <script>
        var p_params;
        $(function(){
            p_params= $.yqWinPopEdit("options");
            init_edit();
        });

        function init_edit(){
            $("#main_edit").yqFormEdit({
                ajaxUrl: p_params.options.ajaxUrl,
                titles: p_params.titles,
                model: p_params.model,
                row: p_params.row,
                loadDefault: false,   //加载默认值
                controlType:1,    //默认显示类型 1-textbox模式  2-div模式
                isEdit: true,
                blankTag: "*",     //值不能为空，标题附加标记
                beforBindingTitle: function (titles, callback) {
                    console.log("beforBindingTitle",titles);
                    callback(titles);
                }, //标题绑定前
                afterBindingTitle: function () { 
                    console.log("afterBindingTitle");
                },   //标题绑定后
                endEditing: function (row) {   //ok.....
                    console.log("endEditing",row);
                },
            });    
        }
 
        function params(){
            console.log(p_params);
        }

        function save(callback){
            var row=$("#main_edit").yqFormEdit("getRow");
            $.yqWinPopEdit("save",{
                row:row,
                callback:function(tf,res){
                    if(tf){
                        if(res.action=="add"){
                            $("#main_edit").yqFormEdit("setRow",res.row);
                        }
                    }
                    console.log(tf,res);
                }
            });
        }

        function close(){
            //p_params.win.dialog("close");
            $.yqWinPopEdit("close");
        }
    </script>
</body>

</html>